package com.ic.loan.activity

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.ic.loan.R
import com.ic.loan.fragment.CustomerFragment
import com.ic.loan.fragment.HomeFragment
import com.ic.loan.fragment.MineFragment
import com.ic.loan.view.BottomBar.ResourceBean
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        initBottom()
    }

    private fun initBottom() {
        bottomBar.bindFragment(
            R.id.fragment, supportFragmentManager, mutableListOf(
                Class.forName(HomeFragment::class.java.canonicalName) as Class<Fragment>,
                Class.forName(CustomerFragment::class.java.canonicalName) as Class<Fragment>,
                Class.forName(MineFragment::class.java.canonicalName) as Class<Fragment>
            )
        )
        bottomBar.setResource(
            mutableListOf(
                ResourceBean(
                    getString(R.string.purse),
                    R.mipmap.ic_bottom_bar_purse_default,
                    R.mipmap.ic_bottom_bar_purse_select
                ),
                ResourceBean(
                    getString(R.string.customer),
                    R.mipmap.ic_bottom_bar_customer_default,
                    R.mipmap.ic_bottom_bar_customer_select
                ),
                ResourceBean(
                    getString(R.string.its_mine),
                    R.mipmap.ic_bottom_bar_mine_default,
                    R.mipmap.ic_bottom_bar_mine_select
                )
            ), R.color.color_999999, R.color.color_f37e20, 0
        )
    }

}